<!-- <title>瑞众银保“五个一”功成--客户经理微沙龙记录<title> -->

<style lang="less" scoped>
@import '@css/list.less';
</style>

<template>
  <div id="app">
    <van-sticky>
      <div class="title">微沙龙记录</div>
    </van-sticky>
    <div style="margin: 20px auto; text-align: center" v-if="yb51MicrosalonRecordList.length == 0">
      暂无数据
    </div>
    <van-collapse
      v-model="activeNames"
      accordion
      v-for="(item, index) of yb51MicrosalonRecordList"
      :key="index"
    >
      <van-collapse-item :title="`主题：${item.theme}`" :label="item.createDate" :name="index">
        <van-cell-group inset>
          <van-field readonly class="fbox" v-model="item.theme" label="主题"></van-field>
          <van-field readonly class="fbox" v-model="item.way" label="渠道/网点"></van-field>
          <van-field class="fbox" v-model="item.holdingDate" label="举办时间" readonly></van-field>
          <van-field class="fbox" v-model="item.product" label="产品" readonly></van-field>
          <van-field
            readonly
            class="fbox"
            v-model="item.attendance"
            label="到场人数"
            placeholder="请填写到场人数"
          ></van-field>
          <van-field readonly class="fbox" v-model="item.num" placeholder="请填写件数"></van-field>
          <van-field readonly class="fbox" v-model="item.premium" label="保费(万)"></van-field>
          <van-field label="图片">
            <template #input>
              <van-uploader
                :deletable="false"
                v-model="item.uploaderImgList"
                :max-count="1"
              ></van-uploader>
            </template>
          </van-field>
        </van-cell-group>
      </van-collapse-item>
    </van-collapse>
  </div>
</template>
<script setup>
import {
  onBeforeMount,
  onMounted,
  onUnmounted,
  watch,
  computed,
  provide,
  inject,
  ref,
  reactive,
  nextTick,
  h
} from 'vue'
import { useRoute, useRouter } from 'vue-router'
const router = useRouter()
const route = useRoute()
const dayjs = inject('$dayjs')
const showPageLoading = inject('showPageLoading')
const hidePageLoading = inject('hidePageLoading')
const showAllNonBaseMenuItem = inject('showAllNonBaseMenuItem')
const hideAllNonBaseMenuItem = inject('hideAllNonBaseMenuItem')
import { isIOS, parseTime, handleFontSize } from '@/utils'
import { yb51_microsalon_recored_getListByWeeksAndAgentCode } from '@/request/api.js'

onMounted(() => {
  agentcode = route.query.agentcode
  weeks = route.query.weeks
  getyb51MicrosalonRecordList()
})

let agentcode
let weeks

const activeNames = ref(['1'])
//获取经理最近三天拜访记录列表
const yb51MicrosalonRecordList = ref([])
function getyb51MicrosalonRecordList() {
  showPageLoading()
  let params = new FormData()
  params.append('agentCode', agentcode)
  params.append('week', weeks)

  yb51_microsalon_recored_getListByWeeksAndAgentCode(params).then((r) => {
    hidePageLoading()
    if (r.status == 200) {
      yb51MicrosalonRecordList.value = r.data.map((item) => {
        item['uploaderImgList'] = [{ url: item.fileUrl }]
        return item
      })
     
    } else {
      console.log('出错了，请重试')
      alert('出错了，请重试')
    }
  })
}
</script>
